from registry import Registry

BACKEND_TYPES = {
    'mongodb': ('mongobackend', 'MongoBackend'),
    'cassandra': ('cassabackend', 'CassaBackend')
}

def initialize():
    registry = Registry()

    registry['config'] = config
    backend_modname = BACKEND_TYPES[config.backend_type][0]
    backend_classname = BACKEND_TYPES[config.backend_type][1]
    backend_module = __import__(backend_modname, globals(), locals(), [], -1)

    registry['backend'] = backend_module.__dict__[backend_classname](config)

    registry['identity_map'] = dict()


initialize()
